<!--{template common/header}-->
<!--{if $submit == true}-->
	<!--{eval 
    	echo "<pre>";
        print_r($_POST);
        echo "</pre>";
    }-->
	<div class="t_f">$noidung</div>
<!--{else}-->
<script type="text/javascript">
	var postminchars = parseInt('{$_G['setting']['minpostsize']}');
	var postmaxchars = parseInt('{$_G['setting']['maxpostsize']}');
</script>

<form id="postform" action="tests.php" method="post" onsubmit="submitForm(this); return false;">
	<input type="hidden" name="formSubmit" value="true" />
    <input type="hidden" name="formhash" id="formhash" value="{FORMHASH}" />
    <input type="hidden" name="wysiwyg" id="{$editorid}_mode" value="{$editormode}" />
    <div class="cl">
    <!--{subtemplate forum/post_editor_body}-->
    </div>
    <div id="{$editorid}_menus" class="editorrow" style="overflow: hidden; margin-top: -5px; height: 0; border: none; background: transparent;">
        <!--{subtemplate common/editor_menu}-->
    </div>
    <div class="p_pof" id="{$editorid}_image_menu" style="display: none" unselectable="on">
        <table width="100%" cellpadding="0" cellspacing="0" class="fwin"><tr><td class="t_l"></td><td class="t_c"></td><td class="t_r"></td></tr><tr><td class="m_l">&nbsp;&nbsp;</td><td class="m_c"><div class="mtm mbm">
        	<ul class="tb tb_s cl" id="{$editorid}_image_ctrl" style="margin-top: 0">
            	<li class="y"><span class="flbc" onclick="hideAttachMenu('image')">{lang close}</span></li>
        	</ul>
    		<div class="p_opt popupfix" unselectable="on" id="{$editorid}_www">
                <table cellpadding="0" cellspacing="0" width="100%">
                    <tr class="xg1">
                        <th width="74%">{lang e_img_inserturl}</th>
                        <th width="13%">{lang e_img_width}</th>
                        <th width="13%">{lang e_img_height}</th>
                    </tr>
                    <tr>
                        <td><input type="text" id="{$editorid}_image_param_1" onchange="loadimgsize(this.value)" style="width: 95%;" value="" class="px" autocomplete="off" /></td>
                        <td><input id="{$editorid}_image_param_2" size="1" value="" class="px p_fre" autocomplete="off" /></td>
                        <td><input id="{$editorid}_image_param_3" size="1" value="" class="px p_fre" autocomplete="off" /></td>
                    </tr>
                    <tr>
                        <td colspan="3" class="pns ptn">
                            <button type="button" class="pn pnc" id="{$editorid}_image_submit"><strong>{lang submit}</strong></button>
                        </td>
                    </tr>
                </table>
            </div>
    	</div></td><td class="m_r"></td></tr><tr><td class="b_l"></td><td class="b_c"></td><td class="b_r"></td></tr></table>
	</div>
    <div class="cl">
        <button type="submit" id="postsubmit" class="pn" value="true" ><strong>Gửi đi</strong></button>
	</div>
</form>

<script type="text/javascript">
	var editorsubmit = $('postsubmit');
	var editorform = $('postform');
	
	if(wysiwyg) {
		newEditor(1, bbcode2html(textobj.value));
	} else {
		newEditor(0, textobj.value);
	}
	<!--{if $editor[simplemode] > 0}-->
		editorsimple();
	<!--{/if}-->
	setCaretAtEnd();
	// Function nay dung de lay toan bo du lieu trong Body bo soan thao convet sang bbcode de gan vao textarea cua form truoc khi gui di
	//doc dong tren nay chua?
	function submitForm(theform){
		// neu dang o trang thai soan thao wysiwyg thi convert sang bbcode truoc khi gui di
		if(wysiwyg){
			textobj.value = html2bbcode(getEditorContents()); // cai nay dung de lay du lieu tu o html de dua vao o textarea....
		}
		theform.submit();
	}
	function hideAttachMenu(id) {
		if($(editorid + '_' + id + '_menu')) {
			$(editorid + '_' + id + '_menu').style.visibility = 'hidden';
		}
	}
</script>
<!--{/if}-->	
<!--{template common/footer}-->